1. Field of the Invention
The method and apparatus of the present invention relates to the field of operating a microprocessor as a slave processor of a host computer system. More particularly, the method and apparatus of the present invention relates to the control of a microprocessor coupled to a host computer system as a peripheral device to provide emulation of a microprocessor system.
2. Related Applications
This application is related to U.S. patent application Ser. No. 07/815,245, titled "Memory Management Structure for I/O Emulation," filed Dec. 31, 1991, and is hereby incorporated by reference.
3. Art Background
Although computers and systems are becoming more sophisticated and faster, there is still a need to be able to be "backward compatible"; that is, there is still a need for the more current computer systems to have the capability to run pre-existing software initially developed to run on older systems. This is particularly the case when the program has an extensive user base or the older system the newer computer system is replacing has a large user base. Thus, computer system manufacturers develop emulation programs that emulate the older system in order to run software designed to run on older systems.
The emulation may be achieved purely through software wherein the software interprets the instructions to be executed and translates them into the form that the newer system understands. However, this is quite time consuming and the system is noticeably slowed. An alternative is provide a mixture of hardware and software to provide the emulation. For example, a powerful workstation such as those manufactured by Sun Microsystems, Inc., Mountain View, Ca., may provide emulation of the disk operating system ("DOS") which typically operates on an IBM personal computer "PC" (manufactured by International Business Machines, Armonk, N.Y.). This emulation may be achieved by connecting the CPU chip utilized in the IBM PC as a peripheral to the workstation wherein the CPU chip can execute the instructions for the software program in a timely manner and the workstation provides the peripheral support. For example, the workstation provides the memory and input/output means to the microprocessor in order to form the system. A popular microprocessor utilized, and the one used in the IBM PC is a CPU chip manufactured by Intel Corporation, Santa Clara, Ca., specifically the Intel 80486, 80386, 80286, 8086 or 8088.
The microprocessor CPU chip coupled to the workstation functions as if the microprocessor is directly connected to the peripheral devices it interacts with. The workstation is not visible to the microprocessor. However, it is sometimes desirable that the workstation temporarily take over or interfere with normal operations of the microprocessor. For example, it may be necessary to monitor the internal contents of the microprocessor registers in order to debug or to measure system performance. Another example is the ability to perform context switching on a microprocessor which does not have multiprocessing capability. These temporary "takeovers" must be performed without disturbing the state of the microprocessor by ensuring that the state of the microprocessor is restored after the takeover is finished.
The more current CPU chips, the 80386 and 80486, provide a number of system operating modes which provide different functionality to the system. For example, the 80486 supports a virtual 86 mode, a real mode and a protected mode. The real mode is an emulation of the original 8086 processor. The virtual 86 mode provides the ability to execute a number of 8086 applications concurrently. The protected mode is sometimes desirable because it provides a means to protect certain pieces of hardware from being accessed by other processes because the process operating in protected mode essentially "owns" the processor. However, because the process "owns" the processor, only one protected mode process may execute at any one time. In 80486 or 80386 based systems this is typically not a problem because by virtue of the microprocessor functionality the user is restricted to execute one protected mode process at a time. However, in an environment where a guest processor is connected to a host processor, whereby processes executed on the guest processor are controlled by and executed through the host processor, it would seem feasible that if the host processor can multi-process then the guest can also multiprocess. However, this is not always a simple task because if the current guest process executing controls the state of the guest processor and the guest processor cannot concurrently execute multiple processes, the current process would have to be terminated on the guest processor before the next process can be executed.
If the guest processor is an 80486 operating DOS in a workstation that allows multi-processing through a window system, the user can open up a plurality of windows, all which could access the 486 processor and execute programs developed to run on the IBM PC and the DOS operating system. When a user attempts to execute two processes using the DOS operating system and both processes include protected mode operations, the processor will not properly execute the processes because it cannot concurrently execute more than one protected mode process. This problem frequently arises during execution of a process which may initially start in one mode, such as the real mode, and then switch mid-point to instructions which are protected and can only be executed in the protected mode. Thus, there is no way to initially determine whether a program requires the protected mode of the microprocessor.